<?php
if(isset($_GET['code']) && isset($_GET['t']) && isset($_GET['r']) && isset($_GET['text']) && isset($_GET['f1']) && isset($_GET['f2']) && isset($_GET['o']) && isset($_GET['a1']) && isset($_GET['a2'])) {
}

	require('config.php');
	require($class_dir.'/BCGColor.php');
	require($class_dir.'/BCGBarcode.php');
	require($class_dir.'/BCGDrawing.php');
	require($class_dir.'/BCGFont.php');
	 include($class_dir . '/BCGcode128.barcode.php');
 function shenimges($text)

{
 
$code="code128";
$o="2";
$t="10";
$r="2";
 $f1="-1";
$f2="8";
$a1="";
$a2="B";
$a3="";
		if($f1 !== '0' && $f1 !== '-1' && intval($f2) >= 1){
			$font = new BCGFont($class_dir.'/font/'.$f1, intval($f2));
		} else {
			$font = 0;
		}
		
		$color_black = new BCGColor(0, 0, 0);
		$color_white = new BCGColor(255, 255, 255);
		$codebar = 'BCG'.$code;
		$code_generated = new $codebar();
		if(isset($a1) && intval($a1) === 1) {
			$code_generated->setChecksum(true);
		}
		if(isset($a2) && !empty($a2)) {
			$code_generated->setStart($a2);
		}
		if(isset($a3) && !empty($a3)) {
			$code_generated->setLabel($a3);
		}
		$code_generated->setThickness($t);
		$code_generated->setScale($r);
		$code_generated->setBackgroundColor($color_white);
		$code_generated->setForegroundColor($color_black);
		$code_generated->setFont($font);
		$code_generated->parse($text);
		$drawing = new BCGDrawing('', $color_white);
		$drawing->setBarcode($code_generated);
		$drawing->draw();
		if(intval($o) === 1) {
		//  header('Content-Type: image/png');
		} elseif(intval($o) === 2) {
		//  header('Content-Type: image/jpeg');
		} elseif(intval($o) === 3) {
		 	// header('Content-Type: image/gif');
		}

	 	//$drawing->finish(intval($_GET['o']));
	 $imgg=	$drawing->get_im();
	 $aname=$text.".jpg";
	 imagejpeg($imgg, $aname);
   

}
 
 



?>